package com.gklyj.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gklyj.pojo.Application;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface applicationMapper extends BaseMapper<Application> {

    //求职者根据条件查询 --审核中
    List<Application> SearchApplication(Application application);

    //求职者根据条件查询 --审核完成
    List<Application> SearchApplication1(Application application);

    //求职者根据审核状态查找不同的申请信息 --审核中
    @Select("select * from application where state = '审核中' and u_id = #{u_id} and name = #{name}")
    List<Application> listByShenhe(Integer u_id,String name);

    //求职者根据审核状态查找不同的申请信息 --审核完成
    @Select("select * from application where state != '审核中' and u_id = #{u_id} and name = #{name}")
    List<Application> listByShenhe1(Integer u_id,String name);

    //招聘单位列出相应的职位申请信息
    @Select("select * from application where department = #{department} and state = #{state}")
    List<Application> listApplicationByDepartment(String department,String state);

    //修改申请信息的状态信息
    @Update("update application set state = #{state} where a_id = #{id}")
    boolean updateStateById(Integer id,String state);

    //招聘根据条件查找申请信息
    List<Application> ZpDifferenceApplicationSearch(Application application);

    //求某天某招聘单位申请的岗位次数
    @Select("select count(*) from application where time = #{time} and department = #{department}")
    Integer getOneDayOneDepartmentApplicationNumber(String time,String department);

    //获取审核中的请求信息数量
    @Select("select count(*) from application where state = '审核中' and department = #{department}")
    Integer getNowApplyApplicationNumber(String department);

    //根据条件差序某个申请信息
    @Select("select * from application where department = #{department} and p_title = #{p_title} and u_id = #{u_id}")
    Application searchOneApplication(Application application);
}
